﻿@model Models.Models.BSetting

@{
    var periods = new WebApp.Services.ServiceService().GetLookUp("BillingPeriod");
    var periodList = new SelectList(periods.LookUpList, "Key", "Value");

    var types = new WebApp.Services.ServiceService().GetLookUp("BillingType");
    var typeList = new SelectList(types.LookUpList, "Key", "Value");
}

<script>
    $(document).ready(function () {
        $('#Date').attr('readonly', 'readonly');
        $('#Date').css('cursor', 'pointer');
        $('#Date').addClass('input-small');

        $('#Date').datepicker({
            showAnim: 'slideDown',
            dateFormat: 'mm/dd/yy'
        });
    });
</script>

@using (Ajax.BeginForm(Model.ID == 0 ? "CreateBSetting" : "EditBSetting", "Billing", null, new AjaxOptions(), new { @id = "formBSetting", @class = "form-horizontal" }))
{        
        <fieldset style="height: 440px; border-style: ridge; border-width: 1px; border-color: #DDDDDD;">
                @Html.ValidationSummary()

                @Html.HiddenFor(model => model.ID)
                @Html.HiddenFor(model => model.StoreID)

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.PeriodID)</label>
                    <div class="controls">@Html.DropDownListFor(m => m.PeriodID, periodList, new { @class = "input-medium" })</div>
                </div>

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.TypeID)</label>
                    <div class="controls">@Html.DropDownListFor(m => m.TypeID, typeList, new { @class = "input-medium" })</div>
                </div>

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.Unit)</label>
                    <div class="controls">@Html.TextBoxFor(m => m.Unit, new { @class = "input-small" })</div>
                </div>

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.Rate)</label>
                    <div class="controls">@Html.TextBoxFor(m => m.Rate, new { @class = "input-small" })</div>
                </div>

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.Date)</label>
                    <div class="controls"><div class="input-append">@Html.EditorFor(m => m.Date, "", new { @id = "datePicker", @class = "datePicker" })</div></div>
                </div>

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.CN)</label>
                    <div class="controls">@Html.TextBoxFor(m => m.CN, new { @class = "input-medium" })</div>
                </div>

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.CE)</label>
                    <div class="controls">@Html.TextBoxFor(m => m.CE, new { @class = "input-small" })</div>
                </div>

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.CustomerPaymentProfileID)</label>
                    <div class="controls">@Html.TextBoxFor(m => m.CustomerPaymentProfileID, new { @class = "input-small", @readonly = "true" })</div>
                </div>

    </fieldset>
        <br />
    
    {
        var rights = new WebApp.Classes.UserRights("Billing Settings");

        if (rights.FullControl || rights.Editable)
        { 
                    <div class="">
                        @if (!Model.RevokeStatus)
                        {
                            if (Model.ID == 0)
                            {
                                <button type="submit" class="btn btn-inverse" id="createBSetting"><i class="icon-ok icon-white"></i> Create</button>            
                            }
                            else
                            { 
                                <button type="submit" class="btn btn-inverse" id="updateBSetting"><i class="icon-ok icon-white"></i> Update</button>                                        
                            }
                        }
                        @if (Model.ID != 0)
                        {
                            if (Model.RevokeStatus)
                            {
                                <button type="button" class="btn btn-inverse" id="activate"><i class="icon-repeat icon-white"></i> Activate</button>
                            }
                            else
                            {                            
                                <button type="button" class="btn btn-inverse" id="revoke"><i class="icon-remove icon-white"></i> Revoke</button>
                            }
                        }
                    </div>
        }
    }

}
